package com.twb.auth.entity.twbResource.dto;

import java.io.Serializable;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

import io.swagger.annotations.ApiModel;

/**
 * @ClassName SearchTwbResourceDto
 * @Description 资源查询出参
 * @author DSY
 * @date 2018年11月9日 下午12:01:01
 */
@ApiModel(value = "SearchTwbResourceDto", description = "/sys/twbResource/search 出参")
public class SearchTwbResourceDto extends TwbResourceDto implements Serializable {

	private static final long serialVersionUID = 1L;
	
	/**
	 * 根据序号排序
	 * @param resList
	 */
	public void sort(List<SearchTwbResourceDto> resList) {
		// 排序
		Collections.sort(resList, new Comparator<SearchTwbResourceDto>() {
			@Override
			public int compare(SearchTwbResourceDto o1, SearchTwbResourceDto o2) {
				if (o1.getResSeq() == null) {
					o1.setResSeq(10000);
				}
				if (o2.getResSeq() == null) {
					o2.setResSeq(10000);
				}
				return o1.getResSeq().compareTo(o2.getResSeq());
			}
		});
	}
}
